﻿/*                              
   Copyright 2011 Nils Kopal, Christopher Krüger, Simone Sauer, Dennis Nolte, Uni Duisburg-Essen

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
using System;
using Sharebert.OverlayLibrary.Messages;

namespace Sharebert.BootstrapServer.API
{
    /// <summary>
    /// Used by the server to send a search result to the server.
    /// </summary>
    public interface IClientHandler
    {

        /// <summary>
        /// Sends the predecessor and successor to the requesting new peer.
        /// </summary>
        /// <param name="neighbours">The predecessor and successor of the peer</param>
        /// <exception cref="NetworkException">Could not send message</exception>
        void SendNeighbours(NeighbourList neighbours);

        /// <summary>
        /// Sends an information to the peer, that the PeerID is already in use.
        /// </summary>
        /// <exception cref="NetworkException">Could not send message</exception>
        void SendPeerIdInUse();

        /// <summary>
        /// Closes the underlying network stream and socket.
        /// </summary>
        void Disconnect();

        /// <summary>
        /// The IP address of the remote client.
        /// </summary>
        string RemoteIP { get; }

        /// <summary>
        /// The port of the remote client.
        /// </summary>
        int RemotePort { get; }

        /// <summary>
        /// The IP address of this server.
        /// </summary>
        string LocalIP { get; }

        /// <summary>
        /// The port of this server.
        /// </summary>
        int LocalPort { get; }

    }
}
